﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BanHangCshap.Class;
namespace BanHangCshap.Class
{
    class PhieuChuyenKhoCT : Database
    {
        #region ***** Fields & Properties *****
        private string _maphieu;
        public string maphieu
        {
            get
            {
                return _maphieu;
            }
            set
            {
                _maphieu = value;
            }
        }
        private string _mahang;
        public string mahang
        {
            get
            {
                return _mahang;
            }
            set
            {
                _mahang = value;
            }
        }
        private string _dvt;
        public string dvt
        {
            get
            {
                return _dvt;
            }
            set
            {
                _dvt = value;
            }
        }
        private double _slchuaquydoi;
        public double slchuaquydoi
        {
            get
            {
                return _slchuaquydoi;
            }
            set
            {
                _slchuaquydoi = value;
            }
        }
        private double _slquydoi;
        public double slquydoi
        {
            get
            {
                return _slquydoi;
            }
            set
            {
                _slquydoi = value;
            }
        }
        private double _slnhapxuat;
        public double slnhapxuat
        {
            get
            {
                return _slnhapxuat;
            }
            set
            {
                _slnhapxuat = value;
            }
        }
        
        private double _dgnhapxuat;
        public double dgnhapxuat
        {
            get
            {
                return _dgnhapxuat;
            }
            set
            {
                _dgnhapxuat = value;
            }
        }
        private double _thanhtien;
        public double thanhtien
        {
            get
            {
                return _thanhtien;
            }
            set
            {
                _thanhtien = value;
            }
        }
        private int _stt;
        public int stt
        {
            get
            {
                return _stt;
            }
            set
            {
                _stt = value;
            }
        }
        #endregion

        #region ***** Init Methods *****
        public PhieuChuyenKhoCT()
        {
        }
        public PhieuChuyenKhoCT(string maphieu)
        {
            this.maphieu = maphieu;
        }
        //public PhieuChuyenKhoCT(string maphieu, string mahang, int slchuyenchuaquydoi, int slchuyen, decimal dgchuyen, decimal thanhtien, int stt)
        //{
        //    this.maphieu = maphieu;
        //    this.mahang = mahang;
        //    this.slchuyenchuaquydoi = slchuyenchuaquydoi;
        //    this.slchuyen = slchuyen;
        //    this.dgchuyen = dgchuyen;
        //    this.thanhtien = thanhtien;
        //    this.stt = stt;
        //}
        public Boolean themPhieuChuyenKhoCT()
        {
            string sql = "insert into PhieuChuyenKhoCT(maphieu,mahang,dvt,dgnhapxuat,slchuaquydoi,slquydoi,slnhapxuat,thanhtien) ";
            sql += " values ('" + maphieu + "','" + mahang + "',N'" + dvt + "'," + dgnhapxuat + "," + slchuaquydoi + "," + slquydoi + "," + slnhapxuat + "," + thanhtien + ")";
            return executeQueryTrans(sql);
        }
        public Boolean xoaPhieuChuyenKhoCT(string maphieu, string mahang)
        {
            string sql = "delete PhieuChuyenKho  where maphieu = '" + maphieu + "' and mahang = '" + mahang + "'";
            return executeQuery(sql);
        }
        public Boolean suaPhieuChuyenKhoCT(string maphieu, string mahang)
        {
            string sql = "update PhieuChuyenKhoCT set maphieu = '" + maphieu + "',mahang = '" + mahang + "',dvt = N'" + dvt + "', ";
            sql += "dgnhapuxuat = " + dgnhapxuat + ",slchuaquydoi = " + slchuaquydoi + ",slquydoi = " + slquydoi + ",slnhapxuat = " + slnhapxuat + ",dgchuyen = " + thanhtien + " where maphieu = '" + maphieu + "' and mahang = '" + mahang + "'";

            return executeQueryTrans(sql);
        }
        #endregion


    }
}
